package io.renren.modules.project.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.project.entity.PginoinoEntity;
import io.renren.modules.project.service.PginoinoService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 项目基本信息表
 *
 * @author yangyf
 * @email 
 * @date 2022-11-18 11:24:32
 */
@RestController
@RequestMapping("project/pginoino")
public class PginoinoController {
    @Autowired
    private PginoinoService pginoinoService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("project:pginoino:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = pginoinoService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{projectId}")
    @RequiresPermissions("project:pginoino:info")
    public R info(@PathVariable("projectId") Long projectId){
		PginoinoEntity pginoino = pginoinoService.getById(projectId);

        return R.ok().put("pginoino", pginoino);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("project:pginoino:save")
    public R save(@RequestBody PginoinoEntity pginoino){
		pginoinoService.save(pginoino);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("project:pginoino:update")
    public R update(@RequestBody PginoinoEntity pginoino){
		pginoinoService.updateById(pginoino);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("project:pginoino:delete")
    public R delete(@RequestBody Long[] projectIds){
		pginoinoService.removeByIds(Arrays.asList(projectIds));

        return R.ok();
    }

}
